Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align defaults for datasource settings #236

Merged
merged 2 commits into from
Jan 23, 2024
Merged

Conversation

BenediktSeidl
Copy link
Contributor

Previously we had two different defaults for the edition setting:

  • one default was set to CEE but was only applied if the datasource settings page was opened and was only applied to the backend after "save" was pressed.
  • the other default setting was set to RAW and was applied in the backend

If you use a provisioned datasource and did not specify the edition explicitly, you saw "CEE" chosen in the UI, but the backend actually used the "RAW" edition.

In order to align this, we chose to set both defaults to CEE.

If you use checkmk raw edition and a provisioned datasource or created the datasource with an very old version of this plugin you have to take manual action:

  • if you use a provisioned datasource: specify the edition explicitly
  • if you used a old version of this plugin to create the datasource: open the datasource settings, make sure the RAW edition is chosen, and save the settings.

You can use the following python script to check if you are affected: (You can only be affected if you use the plugin to fetch matrices from checkmk raw edition.)

import requests

GRAFANA_URL = "http://127.0.0.1:3000/"  # with closing slash

URL = f"{GRAFANA_URL}api/datasources"

GRAFANA_USER = "admin"
GRAFANA_PASSWORD = "password"
data_sources = requests.get(URL, auth=(GRAFANA_USER, GRAFANA_PASSWORD))

for data_source in data_sources.json():
    if data_source["type"] in {"tribe-29-checkmk-datasource", "checkmk-cloud-datasource"}:
        json_data = data_source["jsonData"]
        if "edition" not in json_data:
            print("found affected data_source:")
            print(f'  name: {data_source["name"]}')
            print(f'  id: {data_source["id"]}')
            print(f'  uid: {data_source["uid"]}')

@BenediktSeidl BenediktSeidl force-pushed the fix-conflicting-defaults branch from 5f69f0e to c2b1a1b Compare January 18, 2024 09:53
Previously we had two different defaults for the edition setting:
* one default was set to CEE but was only applied if the datasource
  settings page was opened and was only applied to the backend after
  "save" was pressed.
* the other default setting was set to RAW and was applied in the
  backend

If you use a provisioned datasource and did not specify the edition
explicitly, you saw "CEE" chosen in the UI, but the backend actually
used the "RAW" edition.

In order to align this, we chose to set both defaults to CEE.

**If you use checkmk raw edition and a provisioned datasource or created
the datasource with an very old version of this plugin** you have to take
manual action:
* if you use a provisioned datasource: specify the edition explicitly
* if you used a old version of this plugin to create the datasource:
  open the datasource settings, make sure the RAW edition is chosen, and
  save the settings.

You can use the following python script to check if you are affected:
(You can only be affected if you use the plugin to fetch matrices from
checkmk raw edition.)

```
import requests

GRAFANA_URL = "http://127.0.0.1:3000/"  # with closing slash

URL = f"{GRAFANA_URL}api/datasources"

GRAFANA_USER = "admin"
GRAFANA_PASSWORD = "password"
data_sources = requests.get(URL, auth=(GRAFANA_USER, GRAFANA_PASSWORD))

for data_source in data_sources.json():
    if data_source["type"] in {"tribe-29-checkmk-datasource", "checkmk-cloud-datasource"}:
        json_data = data_source["jsonData"]
        if "edition" not in json_data:
            print("found affected data_source:")
            print(f'  name: {data_source["name"]}')
            print(f'  id: {data_source["id"]}')
            print(f'  uid: {data_source["uid"]}')
```
@BenediktSeidl BenediktSeidl force-pushed the fix-conflicting-defaults branch from c2b1a1b to bbf3f1f Compare January 18, 2024 11:55
We assumed that this can only happen if you query a Checkmk version that
has no graph query endpoints at all. But the enterprise REST-API
endpoint will return a 404 error in Checkmk raw edition, so we adapted
the hint for the user.

Unrelated fix: Checkmk should start with capital letter.
@BenediktSeidl BenediktSeidl merged commit 04c3b3c into main Jan 23, 2024
5 checks passed
@BenediktSeidl BenediktSeidl deleted the fix-conflicting-defaults branch January 23, 2024 14:17
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants